package com.lj.common.exception;

import cn.hutool.core.util.StrUtil;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @author luojing
 * @since 2024/7/25 17:17
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class CommonException extends RuntimeException {
    private Integer code;

    private String msg;

    public CommonException(Integer code, String msg, Object... args) {
        super(StrUtil.format(msg, args));
        this.code = code;
        this.msg = super.getMessage();
    }

    public CommonException(String msg, Object... args) {
        this(500, msg, args);
    }
}
